#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int N=15;

int n,a[N],nx[N],pr[N],ans;
bool b[N*2],c[N*2];

void dfs(int i)
{
	if (i==n+1) 
	{
		ans++;
		return ;
	}
	for (int j=nx[0];j!=n+1;j=nx[j]) 
	if (!b[j+i]&&!c[j-i+n])
	{
		b[j+i]=c[j-i+n]=true;
		nx[pr[j]]=nx[j],pr[nx[j]]=pr[j];
		
		dfs(i+1);
		
		nx[pr[j]]=j,pr[nx[j]]=j;
		b[j+i]=c[j-i+n]=false;
	}
}
int main()
{
	scanf("%d",&n);
	for (int i=0;i<=n+1;i++) nx[i]=i+1,pr[i]=i-1;//?
	dfs(1);
	printf("%d\n",ans);
	return 0;
}

